<html>
<head><meta charset="utf-8"><title>LTO used for released rustcs · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html">LTO used for released rustcs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227051272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227051272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227051272">(Feb 20 2021 at 00:35)</a>:</h4>
<p>Can someone tell me what type of LTO is used to build the released rustc versions (the ones obtainable via rustup)?</p>



<a name="227051328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227051328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227051328">(Feb 20 2021 at 00:36)</a>:</h4>
<p>That is, thin, local thin, or fat?</p>



<a name="227052311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227052311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227052311">(Feb 20 2021 at 00:49)</a>:</h4>
<p>the Cargo.toml file doesn't appear to list anything, so it's probably the default release profile value: <code>lto=false</code></p>



<a name="227053024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053024">(Feb 20 2021 at 00:58)</a>:</h4>
<p>Thanks! So that suggests thin local most likely. I'm a bit surprised. If we're going so far as to do things like PGO, I'd think we'd want do a thing like full crate-graph LTO.</p>



<a name="227053061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053061">(Feb 20 2021 at 00:59)</a>:</h4>
<p>I'd hate to see what that does to compile times :/</p>



<a name="227053177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053177">(Feb 20 2021 at 01:00)</a>:</h4>
<p>I was thinking just for the released ones, not the ones we build for development, or even CI. :)</p>



<a name="227053449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053449">(Feb 20 2021 at 01:04)</a>:</h4>
<p>there's no such things as released binaries, we directly copy from CI to nightly/beta/stable</p>



<a name="227053484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053484">(Feb 20 2021 at 01:05)</a>:</h4>
<p>I believe thinlto is the default though? Or at least that's what I thought was the default</p>



<a name="227053592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053592">(Feb 20 2021 at 01:06)</a>:</h4>
<p>ah, on x86_64-unknown-linux-gnu we build LLVM with ThinLTO</p>



<a name="227053622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053622">(Feb 20 2021 at 01:07)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile#L100">https://github.com/rust-lang/rust/blob/master/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile#L100</a></p>



<a name="227053701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053701">(Feb 20 2021 at 01:08)</a>:</h4>
<p>config::Lto::ThinLocal is the default in rustc at least</p>



<a name="227053718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053718">(Feb 20 2021 at 01:08)</a>:</h4>
<p>so lto just within the local crate</p>



<a name="227053747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227053747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227053747">(Feb 20 2021 at 01:09)</a>:</h4>
<p>which isn't actually reachable with -Clto=thin, that's a full crate graph thinlto</p>



<a name="227054072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227054072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227054072">(Feb 20 2021 at 01:14)</a>:</h4>
<p>Interesting... I'm curious about the impact of doing full graph LTO in CI.</p>



<a name="227054222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227054222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227054222">(Feb 20 2021 at 01:17)</a>:</h4>
<p>You could probably try it on a try build; my guess is it won't be worth the tradeoff of CI time vs runtime wins</p>



<a name="227054299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227054299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227054299">(Feb 20 2021 at 01:18)</a>:</h4>
<p>If you wanted to try it the easiest thing is likely to hack rustbuild to pass it for just Mode::Rustc, grepping for CODEGEN_UNITS is a good start</p>



<a name="227054401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227054401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227054401">(Feb 20 2021 at 01:20)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/LTO.20used.20for.20released.20rustcs/near/227054222">said</a>:</p>
<blockquote>
<p>You could probably try it on a try build; my guess is it won't be worth the tradeoff of CI time vs runtime wins</p>
</blockquote>
<p>Yeah, you might be right. I'm thinking  about a future where our LTO is able to do devirtualization of some trait method calls. Then the wins might be more substantial.</p>



<a name="227055875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227055875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227055875">(Feb 20 2021 at 01:45)</a>:</h4>
<p>Found <a href="https://github.com/rust-lang/rust/issues/49180">#49180</a></p>



<a name="227057927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227057927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227057927">(Feb 20 2021 at 02:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/LTO.20used.20for.20released.20rustcs/near/227054299">said</a>:</p>
<blockquote>
<p>If you wanted to try it the easiest thing is likely to hack rustbuild to pass it for just Mode::Rustc, grepping for CODEGEN_UNITS is a good start</p>
</blockquote>
<p><code>dylib</code> crate types don't support LTO, so I don't think it is possible with the current way it is built.</p>



<a name="227058660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227058660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227058660">(Feb 20 2021 at 02:34)</a>:</h4>
<p><a href="https://doc.rust-lang.org/cargo/reference/profiles.html#release">https://doc.rust-lang.org/cargo/reference/profiles.html#release</a> this says release is false by default (aka thin-local)</p>



<a name="227058694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227058694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227058694">(Feb 20 2021 at 02:35)</a>:</h4>
<p>so that is correct or does it need an update?</p>



<a name="227058774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227058774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227058774">(Feb 20 2021 at 02:36)</a>:</h4>
<p><span class="user-mention" data-user-id="224471">@Lokathor</span> I think that's cargo false, which might mean it's not passed at all to rustc, which is a different default then?</p>



<a name="227058789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227058789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227058789">(Feb 20 2021 at 02:36)</a>:</h4>
<p>yeah that seems to be the case when testing locally</p>



<a name="227058812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227058812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227058812">(Feb 20 2021 at 02:37)</a>:</h4>
<p>cargo and rustc both having defaults can be confusing in cases like this</p>



<a name="227058894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227058894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227058894">(Feb 20 2021 at 02:38)</a>:</h4>
<p>i think we really should be turning this on for rustc that gets sent to the world via rustup, assuming we believe in LTO at all.</p>



<a name="227059416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227059416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227059416">(Feb 20 2021 at 02:48)</a>:</h4>
<p>hm, it seems like an odd claim to make that LTO is right for rustc - it might be right for some situations, but not necessarily rustc</p>



<a name="227059417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227059417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227059417">(Feb 20 2021 at 02:48)</a>:</h4>
<p>e.g. I imagine there could be some size wins</p>



<a name="227059425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227059425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227059425">(Feb 20 2021 at 02:49)</a>:</h4>
<p>er, rather, that if it's not right for rustc, then it's not right for anything</p>



<a name="227059440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227059440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227059440">(Feb 20 2021 at 02:49)</a>:</h4>
<p>that said I have a very small belief in lto :)</p>



<a name="227060321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227060321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227060321">(Feb 20 2021 at 03:04)</a>:</h4>
<p>that last sentence seals it ;P</p>



<a name="227060386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/LTO%20used%20for%20released%20rustcs/near/227060386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/LTO.20used.20for.20released.20rustcs.html#227060386">(Feb 20 2021 at 03:05)</a>:</h4>
<p>Now, pgo for LLVM I think would be good - but that's in the works, just moving slowly</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>